package ua.form;

import org.apache.struts.action.ActionForm;

import ua.model.RoleBean;

@SuppressWarnings("serial")
public class RoleForm extends ActionForm {
	
	RoleBean roleBean=new RoleBean();
	
	public String getId(){
		return roleBean.getId();
	} 
	
	public void setId(String roleid){
		roleBean.setId(roleid);
	}
	
	public RoleBean getRole() {
		return roleBean;
	}
  	
	public void setRole(RoleBean role) {
		this.roleBean = role;
	    this.setId(role.getRolename());
	}
	
	public String getRolename() {
		return roleBean.getRolename();
	}

	public void setRolename(String name) {
		roleBean.setRolename(name);
	}
	
	@Override
	public boolean equals(Object arg0) {
		return roleBean.equals(arg0);
	}
	
	public void save()
	{
		roleBean.save();	
	}

	
	/*@Override
    public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)
    {     
        ActionErrors errors = super.validate(mapping, request);
        if ((roleBean.getRolename()==null || roleBean.getRolename().length()<1)) 
        {
            errors.add("phoneNumber", new ActionMessage("err.rolename"));
        }
        return errors; 
    }*/
}
